﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Http.Cors;

namespace Students.Services
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.EnableCors(new EnableCorsAttribute("*", "*", "*"));

            config.Routes.MapHttpRoute(
                name: "StudentMarksController",
                routeTemplate: "api/students/{studentId}/marks",
                defaults: new { controller = "students", action = "marks" }
            );

            config.Routes.MapHttpRoute(
                name: "StudentController",
                routeTemplate: "api/students",
                defaults: new { controller = "students" }
            );
        }
    }
}
